/*
 * File: leg_VMC.c
 *
 * MATLAB Coder version            : 5.5
 * C/C++ source code generated on  : 07-Jul-2024 15:56:05
 */

/* Include Files */
#include <math.h>

/* Function Definitions */
/*
 * leg_VMC
 *     T = leg_VMC(F,Tp,PHI1,PHI4)
 *
 * Arguments    : float F
 *                float Tp
 *                float phi1
 *                float phi4
 *                float T[2]
 * Return Type  : void
 */
void leg_VMC(float F, float Tp, float phi1, float phi4, float T[2])
{
  float T_tmp;
  float a_tmp;
  float b_T_tmp;
  float t104;
  float t106_tmp;
  float t108;
  float t110;
  float t123_tmp;
  float t124_tmp;
  float t131;
  float t148;
  float t16_tmp_tmp;
  float t174_tmp;
  float t175;
  float t18_tmp_tmp;
  float t35_tmp;
  float t36_tmp;
  float t37_tmp;
  float t38_tmp;
  float t4_tmp;
  float t51_tmp;
  float t54_tmp;
  float t5_tmp;
  float t64_tmp;
  float t6_tmp;
  float t75;
  float t79;
  float t7_tmp;
  float t81;
  float t82;
  float t83;
  float t84;
  float t90;
  float t91;
  float t93;
  float t94;
  /*     This function was generated by the Symbolic Math Toolbox version 9.2.
   */
  /*     22-Jun-2024 16:49:17 */
  t4_tmp = (float)cos(phi1);
  t5_tmp = (float)cos(phi4);
  t6_tmp = (float)sin(phi1);
  t7_tmp = (float)sin(phi4);
  t16_tmp_tmp = t4_tmp / 20.0F;
  t18_tmp_tmp = t6_tmp / 20.0F;
  t35_tmp = t4_tmp * 0.0105F;
  t36_tmp = t5_tmp * 0.0105F;
  t37_tmp = t6_tmp * 0.0105F;
  t38_tmp = t7_tmp * 0.0105F;
  t104 = t18_tmp_tmp - t7_tmp / 20.0F;
  t51_tmp = (t5_tmp / 20.0F - t16_tmp_tmp) + 0.06F;
  t54_tmp = t37_tmp - t38_tmp;
  t64_tmp = (t36_tmp - t35_tmp) + 0.0126F;
  t75 = t104 * t104 + t51_tmp * t51_tmp;
  t81 = t4_tmp * t104 / 10.0F + t6_tmp * t51_tmp / 10.0F;
  t82 = t5_tmp * t104 / 10.0F + t7_tmp * t51_tmp / 10.0F;
  t79 = t104 * t104 + t51_tmp * t51_tmp;
  t83 = t4_tmp * t104 / 10.0F + t6_tmp * t51_tmp / 10.0F;
  t84 = t5_tmp * t104 / 10.0F + t7_tmp * t51_tmp / 10.0F;
  t90 = 1.0F / (t64_tmp + t75);
  t91 = t90 * t90;
  t93 = 1.0F / (t64_tmp + t79);
  t94 = t93 * t93;
  t104 = (float)sqrt((t54_tmp * t54_tmp + t64_tmp * t64_tmp) - t75 * t75);
  t106_tmp = 1.0F / t104;
  t108 = t54_tmp + t104;
  t110 = t54_tmp + t104;
  t51_tmp = (float)atan(t90 * t108) * 2.0F;
  t123_tmp = (float)cos(t51_tmp);
  t124_tmp = (float)sin(t51_tmp);
  t131 = 1.0F / (t91 * (t108 * t108) + 1.0F);
  t104 = 1.0F / (t94 * (t110 * t110) + 1.0F);
  a_tmp = t18_tmp_tmp - t124_tmp * 0.105F;
  t51_tmp = (t16_tmp_tmp + t123_tmp * 0.105F) - 0.03F;
  t148 = (t16_tmp_tmp + t123_tmp * 0.105F) - 0.03F;
  t174_tmp = t51_tmp * t51_tmp;
  t175 = 1.0F / t51_tmp;
  T_tmp = (t37_tmp + t83) * t94 * t110 -
          t93 * (t35_tmp +
                 t106_tmp *
                     ((t4_tmp * t54_tmp * 0.021F + t6_tmp * t64_tmp * 0.021F) -
                      t79 * t83 * 2.0F) /
                     2.0F);
  t81 = (t37_tmp + t81) * t91 * t108 -
        t90 * (t35_tmp +
               t106_tmp *
                   ((t4_tmp * t54_tmp * 0.021F + t6_tmp * t64_tmp * 0.021F) -
                    t75 * t81 * 2.0F) /
                   2.0F);
  b_T_tmp = t124_tmp * t104;
  t6_tmp = t123_tmp * t104;
  t35_tmp = t18_tmp_tmp - t124_tmp * 0.105F;
  t51_tmp = a_tmp * a_tmp + t174_tmp;
  t37_tmp = F * (1.0F / (float)sqrt(t51_tmp));
  t4_tmp = -t123_tmp * t131;
  t83 = -t124_tmp * t131;
  t104 = a_tmp * (1.0F / t174_tmp);
  t51_tmp = Tp * t174_tmp * (1.0F / t51_tmp);
  T[0] = t37_tmp *
             (t148 * (t18_tmp_tmp - b_T_tmp * T_tmp * 0.21F) * 2.0F -
              t35_tmp * (t16_tmp_tmp + t6_tmp * T_tmp * 0.21F) * 2.0F) *
             -0.5F -
         t51_tmp * (t175 * (-t16_tmp_tmp + t4_tmp * t81 * 0.21F) -
                    t104 * (t18_tmp_tmp + t83 * t81 * 0.21F));
  T_tmp = (t38_tmp + t84) * t94 * t110 -
          t93 * (t36_tmp +
                 t106_tmp *
                     ((t5_tmp * t54_tmp * 0.021F + t7_tmp * t64_tmp * 0.021F) -
                      t79 * t84 * 2.0F) /
                     2.0F);
  t81 = (t38_tmp + t82) * t91 * t108 -
        t90 * (t36_tmp +
               t106_tmp *
                   ((t5_tmp * t54_tmp * 0.021F + t7_tmp * t64_tmp * 0.021F) -
                    t75 * t82 * 2.0F) /
                   2.0F);
  T[1] =
      t37_tmp *
          (b_T_tmp * t148 * T_tmp * 0.42F + t6_tmp * t35_tmp * T_tmp * 0.42F) *
          -0.5F +
      t51_tmp *
          (t175 * (t4_tmp * t81 * 0.21F) + t104 * (0.0F - t83 * t81 * 0.21F));
}

/*
 * File trailer for leg_VMC.c
 *
 * [EOF]
 */
